package com.school.entity;

/**
 * 课程类：与Teacher双向关联，提供Getter/Setter供外部访问
 */
public class Course {
    // 私有属性：仅类内部可直接访问，外部需通过Getter获取
    private String courseId;
    private String courseName;
    private String location;
    private String time;
    private int credit;
    private Teacher teacher; // 关联教师

    // 构造方法：初始化课程基本信息（教师通过setTeacher绑定）
    public Course(String courseId, String courseName, String location, String time, int credit) {
        this.courseId = courseId;
        this.courseName = courseName;
        this.location = location;
        this.time = time;
        this.credit = credit;
    }

    // Getter：供外部（如Student、TestSystem）获取课程信息
    public String getCourseId() {
        return courseId;
    }

    public String getCourseName() {
        return courseName;
    }

    public String getLocation() {
        return location;
    }

    public String getTime() {
        return time;
    }

    public int getCredit() {
        return credit;
    }

    public Teacher getTeacher() {
        return teacher;
    }

    // Setter：绑定教师（在Teacher.openCourse()中调用）
    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }
}